<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('排班管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
<!--                            -->
                            <li>
                                <label>月份：</label>
                                <input type="text" name="month"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-info" onclick="$.table.importExcel()">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="am:roster:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="am:roster:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="am:roster:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('am:roster:edit')}]];
        var removeFlag = [[${@permission.hasPermi('am:roster:remove')}]];
        var prefix = ctx + "am/roster";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                importUrl: prefix + "/importData",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "排班管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'rosterId',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'd1',
                    title: '1'
                },
                {
                    field: 'd2',
                    title: '2'
                },
                {
                    field: 'd3',
                    title: '3'
                },
                {
                    field: 'd4',
                    title: '4'
                },
                {
                    field: 'd5',
                    title: '5'
                },
                {
                    field: 'd6',
                    title: '6'
                },
                {
                    field: 'd7',
                    title: '7'
                },
                {
                    field: 'd8',
                    title: '8'
                },
                {
                    field: 'd9',
                    title: '9'
                },
                {
                    field: 'd10',
                    title: '10'
                },
                {
                    field: 'd11',
                    title: '11'
                },
                {
                    field: 'd12',
                    title: '12'
                },
                {
                    field: 'd13',
                    title: '13'
                },
                {
                    field: 'd14',
                    title: '14'
                },
                {
                    field: 'd15',
                    title: '15'
                },
                {
                    field: 'd16',
                    title: '16'
                },
                {
                    field: 'd17',
                    title: '17'
                },
                {
                    field: 'd18',
                    title: '18'
                },
                {
                    field: 'd19',
                    title: '19'
                },
                {
                    field: 'd20',
                    title: '20'
                },
                {
                    field: 'd21',
                    title: '21'
                },
                {
                    field: 'd22',
                    title: '22'
                },
                {
                    field: 'd23',
                    title: '23'
                },
                {
                    field: 'd24',
                    title: '24'
                },
                {
                    field: 'd25',
                    title: '25'
                },
                {
                    field: 'd26',
                    title: '26'
                },
                {
                    field: 'd27',
                    title: '27'
                },
                {
                    field: 'd28',
                    title: '28'
                },
                {
                    field: 'd29',
                    title: '29'
                },
                {
                    field: 'd30',
                    title: '30'
                },
                {
                    field: 'd31',
                    title: '31'
                },
                {
                    field: 'month',
                    title: '月份'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.rosterId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.rosterId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：每次导入会自动覆盖同月份排班数据！！！此外，仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>